﻿using System;
using BLL;

public partial class PCBA_ViewPCBA_ViewPCBAUnionbySN : System.Web.UI.Page
{
    PCBAUnion amd;
    PCBAUnionItem amds;
    private string productSN
    {
        get
        {
            return ViewState["ProductSN"].ToString();
        }
        set
        {
            ViewState["ProductSN"] = value;
        }
    }

    public PCBA_ViewPCBA_ViewPCBAUnionbySN()
    {
        amd = new PCBAUnion();
        amds = new PCBAUnionItem();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["ProductSN"] != null)
            {
                productSN = Request.QueryString["ProductSN"];
                this.TextBox1.Text = productSN;
                productSN = CommHelper.GetProductSN(productSN);
                BindData();
            }
        }
    }

    protected void BindData()
    {
        this.GridView1.DataSource = amd.GetPCBAUnionbySN(productSN);
        this.GridView1.DataBind();
        this.GridView2.DataSource = amds.GetPCBAUnionItembySN(productSN);
        this.GridView2.DataBind();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        productSN = this.TextBox1.Text.Trim();
        productSN = CommHelper.GetProductSN(productSN);
        BindData();
    }
}
